using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_514 : SimTemplate //* 亡者复生 Raise Dead
	{
		//Deal $3 damage to your hero. Return two friendly minions that died this game to your hand.
		//对你的英雄造成$3点伤害。将两个在本局对战中死亡的友方随从移回你的手牌。
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
			int rebornCard = 2;
			p.minionGetDamageOrHeal(ownplay ? p.ownHero : p.enemyHero, 3);
			foreach (KeyValuePair<CardDB.cardIDEnum, int> e in Probabilitymaker.Instance.ownCardsOut)
            {
                bool died = true;
                // 如果就在场上不认为已死亡
                foreach ( Minion mm in p.ownMinions ){
                    if(mm.handcard.card.cardIDenum == e.Key && e.Value < 2){
                        died = false;
                        break;;
                    }
                }
                // 死亡随从
                CardDB.Card rebornMob = CardDB.Instance.getCardDataFromID(e.Key);
                // 不是已死亡随从退出
                if(!died || rebornMob.type != CardDB.cardtype.MOB) continue;
				Helpfunctions.Instance.ErrorLog("亡者复生将获得" + rebornMob.chnName);
                
				rebornCard --;
				if(rebornCard < 0) break;
				p.drawACard(e.Key, ownplay, true);
            }
			if( rebornCard >= 0){
				p.evaluatePenality += rebornCard * 10;
			}
		}
	}
}
